

#include <complex>
#include <iostream>

template<class T>
struct Real {
	typedef T Type;
	static T real(T x) {
		return x;
	}
};

template<class T>
struct Real<std::complex<T>> {
	typedef T Type;
	static T real(std::complex<T> x) {
		return std::real(x);
	}
};

template<class T>
typename Real<T>::Type f(T x)
{
	return Real<T>::real(x);
}


int main() {
	std::complex<int> x(1, 2);

	std::cout << f(x) << std::endl;
}
